export default function makeQuery(query_str, params) {
    return {
        "query": query_str,
        "extern": {
            "type": "File",
            "package": null,
            "imports": null,
            "body": [
                {
                    "type": "OptionStatement",
                    "assignment": {
                        "type": "VariableAssignment",
                        "id": {
                            "type": "Identifier",
                            "name": "v"
                        },
                        "init": {
                            "type": "ObjectExpression",
                            "properties": [
                                {
                                    "type": "Property",
                                    "key": {
                                        "type": "Identifier",
                                        "name": "timeRangeStart"
                                    },
                                    "value": {
                                        "type": "UnaryExpression",
                                        "operator": "-",
                                        "argument": {
                                            "type": "DurationLiteral",
                                            "values": [
                                                {
                                                    "magnitude": params.startTime,
                                                    "unit": params.startTimeUnit
                                                }
                                            ]
                                        }
                                    }
                                },
                                {
                                    "type": "Property",
                                    "key": {
                                        "type": "Identifier",
                                        "name": "timeRangeStop"
                                    },
                                    "value": {
                                        "type": "CallExpression",
                                        "callee": {
                                            "type": "Identifier",
                                            "name": "now"
                                        }
                                    }
                                },
                                {
                                    "type": "Property",
                                    "key": {
                                        "type": "Identifier",
                                        "name": "windowPeriod"
                                    },
                                    "value": {
                                        "type": "DurationLiteral",
                                        "values": [
                                            {
                                                "magnitude": 480000,
                                                "unit": "ms"
                                            }
                                        ]
                                    }
                                }
                            ]
                        }
                    }
                }
            ]
        },
        "dialect": {
            "annotations": [
                "group",
                "datatype",
                "default"
            ]
        }
    };

}

